import tkinter as tk

root = tk.Tk()  # 创建窗口
root.title('隐马尔科夫词性标注系统')
root.geometry('1068x681+200+50')  # 设置窗口大小和位置
 
 
accuracy_lable = tk.Label(root, text="测试准确率:", font=('Arial', 15), width=10)  # 显示测试准确率
accuracy_lable.place(x=5, y=50, anchor='nw')
accuracy_Text = tk.Label(root, text='{:.2%}'.format(accuracy), width=20, height=1,
                         bg="white", fg="black", font=("宋体", 14), bd='0')  # 测试准确率输出框
accuracy_Text.place(x=130, y=50, anchor='nw')
 
input_name_lable = tk.Label(root, text="请输入文字:", font=('Arial', 15), width=10)  # 显示输入框标签
input_name_lable.place(x=5, y=100, anchor='nw')
input_name_Text = tk.Text(root, width=53, height=28, bg="white", fg="black", font=("宋体", 13), bd='0')  # 文本录入框
input_name_Text.place(x=5, y=130, anchor='nw')
 
sex_label = tk.Label(root, text="标注结果:", font=('Arial', 15), width=10)  # 显示标注结果标签
sex_label.place(x=500, y=100, anchor='nw')
sex_Text = tk.Text(root, width=59, height=28, bg="white", fg="black", font=("宋体", 13), bd='0')  # 标注结果显示框
sex_Text.place(x=500, y=130, anchor='nw')
 
# 按钮
sex_button = tk.Button(root, text="词性标注", bg="lightblue", width=10, font=('黑体', 12),
                       command=predict_gender)  # 调用内部方法  加()为直接调用
sex_button.place(x=400, y=620, anchor='nw')
quit_button = tk.Button(root, text="退   出", bg="lightblue", width=10, font=('黑体', 12),
                        command=root.quit)  # 调用内部方法加()为直接调用
quit_button.place(x=600, y=620, anchor='nw')
 
# 文档路径选择
path = tk.StringVar()
path.set(os.path.abspath(".."))
tk.Label(root, text="目标路径:").grid(row=0, column=0)
tk.Entry(root, textvariable=path, state="readonly").grid(row=0, column=1, ipadx=90)
tk.Button(root, text="选择文件", command=callback).grid(row=0, column=2)  # 调用选择文件路径函数